<script lang="ts" setup>
import { reactive } from 'vue'
import { useRouter ,useRoute} from 'vue-router';
import axios from 'axios';
let route=useRoute()
const book= reactive({
  id:route.query.id,
  type: '',
  name: ''
})
let router=useRouter()
const onSubmit = async () => {
  await axios.put("http://localhost:8080/api/updateBooks",book)
  router.push("/")
}
</script>
<template>
  <el-form :inline="true" :model="book" class="demo-form-inline">
    <el-form-item label="书名">
      <el-input v-model="book.name" placeholder="name" clearable />
    </el-form-item>
    <el-form-item label="类型">
      <el-input v-model="book.type" placeholder="type" clearable />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onSubmit">提交</el-button>
    </el-form-item>
  </el-form>
</template>

<style>
.demo-form-inline .el-input {
  --el-input-width: 220px;
}

.demo-form-inline .el-select {
  --el-select-width: 220px;
}
</style>
